/*
 *http://www.apache.org/licenses/LICENSE-2.0
 *Copyright (c) 2021 fullset
 *@ClassName SysMenuController
 *@date 2021/6/5 10:52
 *@Description 菜单管理
 */
package com.fs.base.controller;

import com.fs.base.service.SysMenuService;
import com.fs.core.web.BaseResult;
import com.fs.orm.entity.SysMenu;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@Api(tags="菜单接口")
@RestController
@RequestMapping("/baseService/menu")
public class SysMenuController {

    @Autowired
    private SysMenuService sysMenuService;

    @ApiOperation(value = "删除菜单", notes = "逻辑删除")
    @PostMapping(value ="/logicalDel/{id}")
    public BaseResult<Boolean> logicalDel(@PathVariable String id)  {
        return new BaseResult<>(sysMenuService.logicalDeleteById(id));
    }

    @ApiOperation(value = "系统菜单列表", notes = "菜单管理")
    @PostMapping(value ="/laytable")
    public BaseResult<List<SysMenu>> getLayTable() {
        List<SysMenu> listSysMenu = sysMenuService.getList();
        return new BaseResult<>(listSysMenu);
    }

    @ApiOperation(value="菜单列表", notes="用户菜单导航")
    @PostMapping(value ="/initNav")
    public BaseResult<List<SysMenu>> getInitNav() {
        return new BaseResult<>(sysMenuService.getList());
    }
}
